package C07.List01;

import java.util.ArrayList;
public class ArrayListUse01 {
    public static void main(String[] args) {
        int[] arrayInts = new int[3];
        arrayInts[0] = 10;
        arrayInts[1] = 55;
        arrayInts[2] = 66;

        arrayInts[1] = 0;
        arrayInts[2] = 99;

        for (int i = 0; i < arrayInts.length; i++) {
            System.out.println(arrayInts[i]);
        }

        System.out.println("=========================");
        ArrayList list = new ArrayList();
        list.add("张三");
        list.add("李四");
        list.add(true);
        list.add(new Student());
        System.out.println("增加：" + list);

        list.add(list.size(), "王五");
        System.out.println("添加到最后一个:" + list);

        list.add(0, "王五123");
        System.out.println("添加到第一个" + list);
        list.remove(true);
        list.remove("张三");
        System.out.println("删除两个：" + list);
        list.remove(list.size() - 1);
        System.out.println("通过下标删除最后一个:" + list);
        list.remove(0);
        System.out.println("通过下标删除第一个:" + list);
        list.set(1, "李四666");
        System.out.println(list);
        int index = list.indexOf("李四666");
        System.out.println(index);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(i + "----" + list.get(i));
        }
    }
}